<?php
    Yii::import('zii.widgets.CPortlet');

    class TagCloud extends CPortlet
    {
        
        public $maxTags=20;
        public function init()
        {
            $this->title=Yii::t('Site','TAG');  
            parent::init();
        }
        protected function renderContent()
        {
            
            $tags=Tag::model()->findTagWeights();

            foreach($tags as $tag=>$weight)
            {
                $link=CHtml::link(CHtml::encode($tag), array('post/index','tag'=>$tag));
                echo CHtml::tag('span', array(
                'class'=>'tag',
                'style'=>"font-size:{$weight}pt",
                ), $link)."\n";
            }
        }
    }
?>
